Spark Message End Solution | Implementation Template icon

Spark Message End Solution | Implementation Template

(0 reviews)

Setup Instructions

To get this template to run, there are several preconditions to consider. Failing to do so can lead to connectivity errors. These preconditions are:

  • Veeva Vault Credentials – Require Vault URL, Username, Password, Vault API Version, Client Id.
  • JKS Certificate for HTTPS connector – Require .jks file for HTTPS Listener to received Spark message over TLS connection with Vault. Following are the steps to follow to create .jks file, you can use Java Keytool located under JDK_HOME/bin directory. Below is an example:

a. Run command from /bin directory.

keytool -genkey -keyalg RSA -alias selfsigned -keystore spark-listener.jks - storepass password -validity 360 -keysize 2048

b. This will create spark-listener.jks file at current directory.

c. Copy/Import spark-listener.jks file under project directory (src/main/resources).

  • Following configuration to be added in files:
a. pom.xml
   Maven Compiler Plugins
   <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
       <version>3.8.1</version>
       <configuration>
           <compilerArgs>
              <arg>-parameters</arg>
           </compilerArgs>
       </configuration>
   </plugin>

   JSON Dependency
   <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20170516</version>
   </dependency>

b. mule-artifact.json
   {
     "configs": [
          "spark-message-end-solution.xml"
     ],
     "secureProperties": [],
     "redeploymentEnabled": true,
     "name": "mulejava",
     "minMuleVersion": "4.1.5",
     "requiredProduct": "MULE_EE",
     "classLoaderModelLoaderDescriptor": {
         "id": "mule",
         "attributes": {
             "exportedResources": [
             ],
             "exportedPackages":[
                 "com.mulesoft.loan.approval",
                 "org.json.json"
             ]
         }
     },
     "bundleDescriptorLoader": {
        "id": "mule",
        "attributes": {}
     }
   }

Note: The above snippet is already included in template.
  • While Deploying on Cloudhub it is recommended to select more than 1 vCore based on number of records and its size of each record.
  • Note – As per Veeva Systems, the public key (00001.pem) expires every two years. The customer gets notification in well advance about its expiry date, so make sure that after public key expiration date you need to remove public key file from the path configured in field (Public Key Path) and it will create new public key file while execution. Otherwise Spark message verification would be failing as INVALID_SPARK_MESSAGE. The template deployed on Cloudhub with default path need to restart for successful Spark Message verification.
  • The Spark Message Request Timeout on the Vault must be increased from the default of 5 seconds to 10, to ensure the message will be successfully validated. This can be done by raising a Veeva Support ticket.

Configure and Run

In this section we detail the way you should run your template on your computer.

Where to Download Anypoint Studio and the Mule Runtime

If you are new to Mule, download this software:

Import Template in Studio

In Studio, click the Exchange X icon in the upper left of the taskbar, log in with your Anypoint Platform credentials, search for the template, and click Open.

Configuring Vault for Spark Messaging

  1. Before configuring Vault to trigger Spark Message recommended to walk through about Spark Messaging details.
  2. Vault Configuration to trigger Spark message:

a. Create Vault Connection.

Note – Configure URL field in this step with HTTPS Listener endpoint configured in flow (spark-message-validate-and-publish-flow).

b. Import Vault Packages

Note – Sample vault package (vsdk-spark-code-only.vpk) is included in this template (src/main/resources/vaultpackage) which can be used to import on vault for triggering the Spark message.

c. Create Vault Queue

Run in Studio

Open the template in Anypoint Studio. Make sure that HTTPS Listener hostname/port is map with endpoint URL available in public network and this endpoint URL is defined on Vault as mentioned in Configuring Vault for Spark Messaging – step 2.a. With these configuration Spark message triggered from vault would reach an application deployed in Studio.

Follow these steps to run it:

1. Right click the template project folder.
2. Hover your mouse over Run as.
3. Click Mule Application.
4. Click Run.
5. Once application is deployed.
6. Trigger the Spark Message -- Follow the steps in Part 1.
7. Optional - Trigger bulk records using Loader -- Follow the steps of Loading Object Records. Note – Sample loan records CSV file is included in template at location (src/main/resources/testdata/loan-approval-records-for-spark-message.csv).
8. You can check the Loan records are updated on Vault.

Run Stand Alone

Complete all properties in one of the property files, for example in configuration.yaml and run your app with the corresponding environment variable to use it.

Make sure that HTTPS Listener hostname/port is map with endpoint URL available in public network and the endpoint URL is configured on Vault as mentioned in Configuring Vault for Spark Messaging – step 2.a. With these configuration Spark message triggered from vault would reach an application deployed.

Follow the steps (6 – 8) defined under Run in Studio.

Run in CloudHub

After adding the application to Runtime Manager, go to Manage Application > Properties to set the environment variables listed in the Properties to Configure section.

Make sure Cloudhub endpoint URL is configured on Vault as mentioned in Configuring Vault for Spark Messaging – step 2.a. With these configuration Spark message triggered from vault would reach an application deployed on Cloudhub. Follow the steps (6 – 8) defined under Run in Studio.

Deploy in CloudHub

In Studio, right click your project name in Package Explorer and select Anypoint Platform > Deploy on CloudHub.

Properties to Configure

To use this template, you need to configure properties (credentials, configurations, etc.) either in a properties file or in Runtime Manager as Environment Variables.

Application Properties

    http:
      host: "0.0.0.0"
      port: "8082"

    veeva:
      vaultURL: your-vault-url.
      username: your-vault-username.
      password: your-vault-password.
      version : vault-api-version (e.g: v19.1).
      clientId: {company}-{organization}-{server}-{component} format.

    file:
      keyPath: "${app.home}/publickeys"

    vm:
      queue:
        name: "spark-queue"
        consumer: "1"
        timeout: "60"

Reviews

TypeTemplate
OrganizationMuleSoft
Published by
MuleSoft Partner
Published onJul 24, 2020
Asset overview

Asset versions for 1.0.x

Asset versions
VersionActions
1.0.0

Categories

Industry Vertical
HealthcareNo values left to add

Tags